package com.blacktry.mapper;

import com.blacktry.entity.model.PaperManage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 试卷管理表 Mapper 接口
 * </p>
 *
 * @author blackTry
 * @since 2021-08-10
 */
public interface PaperManageMapper extends BaseMapper<PaperManage> {

    @Select("SELECT distinct paper_id from paper_manage ")
    List<Integer> findAllIds();

    @Delete("<script> delete from paper_manage where paper_id = #{paperId} and question_type = #{questionType}  and question_id in <foreach collection='questionIds' item='questionId' open='(' separator=',' close=')'>#{questionId}</foreach> </script>")
    Integer deleteBatchIdsByPaperIdAndQuestionId(Integer paperId,List<String> questionIds,Integer questionType);

    @Delete("delete from paper_manage where paper_id = #{paperId} and question_id = #{questionId} and question_type = #{questionType}")
    Integer deleteByPaperIdAndQuestionId(Integer paperId,Integer questionId,Integer questionType);
}
